package one.one.thirtyFive;

import java.util.Arrays;
import java.util.Random;

public class Sides {

	static double[] target() {
		int SIDES = 6;
		double[] dist = new double[2 * SIDES + 1];
		for (int i = 1; i <= SIDES; i++) {
			for (int j = 1; j <= SIDES; j++) {
				dist[i + j] += 1.0;
			}
		}

		for (int k = 2; k <= 2 * SIDES; k++) {
			dist[k] /= 36.0;
		}
		return dist;
	}

	public static void main(String[] args) {
		int N = 100000;
		// boolean r = false;
		one: for (int n = N; n <= N * 100; n++) {
			System.out.println("Enter " + n);
			double[] t = target();

			double[] d = new double[13];

			Random random = new Random();
			int f, s;
			for (int i = 0; i < N; i++) {
				f = random.nextInt(6) + 1;
				s = random.nextInt(6) + 1;
				d[f + s] += 1.0;
			}

			for (int i = 0; i <= 12; i++) {
				d[i] /= N;
			}
			double diff;
			for (int i = 0; i <= 12; i++) {
				diff = Math.abs(d[i] - t[i]);
				if (diff >= 0.001) {
					continue one;
				}
			}
			System.out.println("N:"+n);
			break;
		}
	}

}
